//
//  LSZPoorHouseholdEnquiriesVC.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/10/17.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZPoorHouseholdEnquiriesVC.h"

@interface LSZPoorHouseholdEnquiriesVC ()
@property(nonatomic,strong) UITextField * textFieldName;
@property(nonatomic,strong) UITextField * textFieldPhone;
@property(nonatomic,strong) UITextField * textFieldIdCard;

@end

@implementation LSZPoorHouseholdEnquiriesVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"贫困户查询";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setPoorUI];
}
-(void)setPoorUI
{
    UILabel * labelName = [[UILabel alloc]init];
    labelName.frame = CGRectMake(20, 20+NAVIGATION_BAR_HEIGHT,70, 20);
    labelName.font = FONT_(14);
    labelName.textColor = titleColorLSZ;
    labelName.text = @"户主姓名:";
    [self.view addSubview:labelName];
    self.textFieldName = [[UITextField alloc]init];
    self.textFieldName.frame = CGRectMake(CGRectGetMaxX(labelName.frame)+5, CGRectGetMinY(labelName.frame), ScreenWidth-20-CGRectGetMaxX(labelName.frame), labelName.frame.size.height);
    self.textFieldName.placeholder = @"请输入姓名";
    self.textFieldName.font = FONT_(14);
    [self.view addSubview:self.textFieldName];
    
    UILabel * labelPhone = [[UILabel alloc]init];
    labelPhone.frame = CGRectMake(20, 20+CGRectGetMaxY(labelName.frame), 70, 20);
    labelPhone.font = FONT_(14);
    labelPhone.textColor = titleColorLSZ;
    labelPhone.text = @"手  机  号:";
    [self.view addSubview:labelPhone];
    self.textFieldPhone = [[UITextField alloc]init];
    self.textFieldPhone.frame = CGRectMake(CGRectGetMaxX(labelPhone.frame)+5, CGRectGetMinY(labelPhone.frame), ScreenWidth-20-CGRectGetMaxX(labelPhone.frame), labelPhone.frame.size.height);
    self.textFieldPhone.placeholder = @"请输入手机号";
    self.textFieldPhone.font = FONT_(14);
    [self.view addSubview:self.textFieldPhone];
    
    UILabel * labelIdCard = [[UILabel alloc]init];
    labelIdCard.frame = CGRectMake(20,20+CGRectGetMaxY(labelPhone.frame), 70, 20);
    labelIdCard.font = FONT_(14);
    labelIdCard.textColor = titleColorLSZ;
    labelIdCard.text = @"身份证号:";
    [self.view addSubview:labelIdCard];
    self.textFieldIdCard = [[UITextField alloc]init];
    self.textFieldIdCard.frame = CGRectMake(CGRectGetMaxX(labelIdCard.frame)+5, CGRectGetMinY(labelIdCard.frame), ScreenWidth-20-CGRectGetMaxX(labelIdCard.frame), labelIdCard.frame.size.height);
    self.textFieldIdCard.placeholder = @"请输入身份证号";
    self.textFieldIdCard.font = FONT_(14);
    [self.view addSubview:self.textFieldIdCard];
    
    
    UIButton * butOK = [[UIButton alloc]init];
    butOK.frame = CGRectMake(20, CGRectGetMaxY(labelIdCard.frame)+150, ScreenWidth-40, 45);
    butOK.backgroundColor = themeColor;
    [butOK.layer setMasksToBounds:YES];
    [butOK.layer setCornerRadius:4];
    butOK.titleLabel.font = FONT_(16);
    [butOK setTitle:@"查  询" forState:UIControlStateNormal];
    [butOK addTarget:self action:@selector(clickOk) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:butOK];
}
#pragma mark - 查询贫困户
-(void)clickOk
{
//    self.textFieldPhone.text = @"18638723098";
    if ((NullStringjudgment(NSStr(self.textFieldName.text))).length == 0 && (NullStringjudgment(NSStr(self.textFieldPhone.text))).length == 0 && (NullStringjudgment(NSStr(self.textFieldIdCard.text))).length == 0) {
        [self initWithtring:@"请输入搜索条件!"];
        return;
    }
    [LSZRequestDicData initInquiryOfPoorHouseholds:self.textFieldName.text phoneStr:self.textFieldPhone.text cardIDStr:self.textFieldIdCard.text :^(BOOL isOk, NSString * string, LSZInquiryPoorHouseholdsManager * inquiryPoorHouseholdsManager) {
        if (isOk == YES) {
            LSZPoorHouseholdViewController * VC = [[LSZPoorHouseholdViewController alloc]init];
            VC.inquiryPoorHouseholdsManager = inquiryPoorHouseholdsManager;
            [self.navigationController pushViewController:VC animated:YES];
        }else{
            [LSZPublicClassDataToll initWithAlertKuangView:self.view string:string];
        }
    }];
}
@end
